/**
 * 路由对象模块
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Message from '../views/Message'
import News from '../views/News'
import About from '../views/About'
import Home from '../views/Home'
import MessageDetail from '../views/MessageDetail'

Vue.use(VueRouter)

export default new VueRouter({
  // 注册应用中所有的路由
  routes: [
    {
      path: '/about',
      component: About
    },
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: '/home/news',// 使用绝对路径
          component: News
        },
        {
          path: 'message',// 使用相对路径
          component: Message,
          children: [
            {
              path:'detail/:id', // 1.使用router中的param进行传递
              // path:'detail', // 2.使用router中的query传递进行传递，router-link to中带?进行传递
              component: MessageDetail
            }
          ]
        },
        {
          path: '',
          redirect: '/home/news'
        }
      ]
    },
    {// 默认路由配置
      path: '/',
      redirect: '/about'
    }
  ]
})

